package pb

import (
	. "chess_platform/internal/common"
	"chess_platform/models/pb"
)

//[pb]财务相关
type FinanceController struct {
	GrantController
}

func (b *FinanceController) URLMapping() {
	b.Mapping("ListCashRecord", b.ListCashRecord)
}

// @Title 合伙人系统代理的提成收入
// @Description 合伙人系统代理的提成收入
// @Param   page_size    body   int     true       "每页显示数量"
// @Param   page_index   body   int     true       "第几页"
// @Success 0 {object} []common.CashRecord
// @router /list-cash-record [post]
func (b *FinanceController) ListCashRecord() {
	var p ListParams
	if !b.DecodeParams(&p) {
		return
	}
	if !b.ValidParams(&p) {
		return
	}
	//一级代理提成列表(首页中展示,因为二级代理产生的收益)
	cr, count, err := pb.ListCashRecord(p, b.Uid)
	if err != nil {
		LogPF.Error(b.DatabaseError(err.Error()))
		return
	}
	b.Res.Data = cr
	b.Res.Count = count
	b.ResponseSuccess()
}
